/* GUI CONVERTED from rcscmtb3.p (converter v1.75) Sat Aug 12 23:01:30 2000 */
/* rcscmtb3.p - Release Management Customer Schedules                         */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/*V8:ConvertMode=Maintenance                                                  */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                       */
/* REVISION: 8.6    LAST MODIFIED: 09/20/96           BY: TSI *K005*          */
/* REVISION: 8.6E   LAST MODIFIED: 04/10/98           BY: *K1ND* A. Licha     */
/* REVISION: 8.6E   LAST MODIFIED: 05/20/98           BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E   LAST MODIFIED: 10/04/98           BY: *J314* Alfred Tan   */
/* REVISION: 8.6E   LAST MODIFIED: 08/19/99           BY: *K229* Surekha Joshi*/
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb                  */

         /* SCHEDULE DETAIL MAINT SUBPROGRAM */

         {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

         /* INPUT PARAMETERS */
         define input parameter schddet_recid as recid no-undo.
/*K1ND*/ define input parameter new_schd_det as logical no-undo.

         /* LOCAL VARIABLES */
         define variable i as integer no-undo.
         define variable cmmts as logical no-undo.
         define variable rqmts as logical no-undo.
         define variable where_we_are as integer no-undo.
/*K1ND*/ define variable is_first as logical no-undo.

         {rcscfrm.i}

         do with frame sched_det:

            find schd_det
               where recid(schd_det) = schddet_recid
               exclusive-lock no-error.

            find sch_mstr
               where sch_type     = schd_type
                 and sch_nbr      = schd_nbr
                 and sch_line     = schd_line
                 and sch_rlse_id  = schd_rlse_id
               no-lock no-error.

            /* PRIME FRAME POSITION */
            display
               schd_date when (available schd_det).

            where_we_are = frame-line.

/*K1ND*/    if new_schd_det and frame-line <> frame-down then do:
/*K1ND*/       do i = 1 to where_we_are + 1 while available schd_det:

/*K229*/          /* DO NOT DISPLAY/PRINT COMPLETELY SHIPPED SCHD_DET RECORDS */
/*K1ND*/          find prev schd_det
/*K1ND*/             where schd_type                         = sch_type
/*K1ND*/               and schd_nbr                          = sch_nbr
/*K1ND*/               and schd_line                         = sch_line
/*K1ND*/               and schd_rlse_id                      = sch_rlse_id
/*K229*/               and trim(substring(schd_fc_qual,2,1)) = ""
/*K1ND*/             no-lock no-error.
/*K1ND*/       end.
/*K1ND*/    end.
/*K1ND*/    else
            do i = 1 to where_we_are while available schd_det:

/*K229*/       /* DO NOT DISPLAY/PRINT COMPLETELY SHIPPED SCHD_DET RECORDS */
               find prev schd_det
                  where schd_type                         = sch_type
                    and schd_nbr                          = sch_nbr
                    and schd_line                         = sch_line
                    and schd_rlse_id                      = sch_rlse_id
/*K229*/            and trim(substring(schd_fc_qual,2,1)) = ""
                  no-lock no-error.
            end.

/*K1ND*/    /* DETERMINE IF THE TOP MOST RECORD IN THE FRAME IS VERY FIRST */
/*K1ND*/    /* SCHD_DET RECORD */
/*K1ND*/    if not available schd_det then
/*K1ND*/       is_first = yes.
/*K1ND*/    else
/*K1ND*/       is_first = no.

            up where_we_are - 1.

            do i = 1 to frame-down:
/*K1ND*/       if i = 1 and is_first then

/*K229*/          /* DO NOT DISPLAY/PRINT COMPLETELY SHIPPED SCHD_DET RECORDS */
/*K1ND*/          find first schd_det where schd_type = sch_type
/*K1ND*/                             and schd_nbr     = sch_nbr
/*K1ND*/                             and schd_line    = sch_line
/*K1ND*/                             and schd_rlse_id = sch_rlse_id
/*K229*/                             and trim(substring(schd_fc_qual,2,1)) = ""
/*K1ND*/          no-lock no-error.
/*K1ND*/       else

/*K229*/       /* DO NOT DISPLAY/PRINT COMPLETELY SHIPPED SCHD_DET RECORDS */
               find next schd_det
                  where schd_type                         = sch_type
                    and schd_nbr                          = sch_nbr
                    and schd_line                         = sch_line
                    and schd_rlse_id                      = sch_rlse_id
/*K229*/            and trim(substring(schd_fc_qual,2,1)) = ""
                  no-lock no-error.

               if available schd_det then
               do:
                  {gprun.i ""rcrqmyn.p"" "(input recid(schd_det),
                                           input-output rqmts)"}
/*GUI*/ if global-beam-me-up then undo, leave.


                  display
                     schd_date
                     schd_time
                     schd_interval
                     schd_reference
                     schd_upd_qty
                     schd_fc_qual
                     if schd_cmtindx > 0 then yes else no @ cmmts
                     rqmts.

                  where_we_are = if recid(schd_det) = schddet_recid
                                    then frame-line else where_we_are.
               end.
               else
                  display
                     "" @ schd_date
                     "" @ schd_time
                     "" @ schd_interval
                     "" @ schd_reference
                     "" @ schd_upd_qty
                     "" @ schd_fc_qual
                     "" @ cmmts
                     "" @ rqmts.

               if i < frame-down then down 1.
            end. /* i = 1 to frame-down */

            up frame-down - where_we_are.

         end. /* do with frame sched_det */
